package com.ocean.common.utils.swf;

import com.ocean.common.utils.file.FileUtils;

public class DocConverter {

	private PDFConverter pdfConverter;
	private SWFConverter swfConverter;


	public DocConverter(PDFConverter pdfConverter, SWFConverter swfConverter) {
		super();
		this.pdfConverter = pdfConverter;
		this.swfConverter = swfConverter;
	}


	public  void convert(String inputFile,String swfFile,String extend){
		this.pdfConverter.convert2PDF(inputFile,extend);
		String pdfFile = inputFile.substring(0, inputFile.lastIndexOf(".")).replaceAll("\\s*", "")+".pdf";
		this.swfConverter.convert2SWF(pdfFile, swfFile);
	}

	public void convert(String inputFile,String extend){
		this.pdfConverter.convert2PDF(inputFile,extend);
		String pdfFile = inputFile.substring(0, inputFile.lastIndexOf("."))+".pdf";
		extend= FileUtils.getNameNotSuffix(pdfFile);
		this.swfConverter.convert2SWF(pdfFile,extend);

	}

}
